﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using DAO;
using DTO;

namespace BUS
{
   public class DocGiaService
    {
       public static void ThemDocGia(DocGiaDTO docGiaDTO)
       {
           try
           {
               DocGiaRepository dgRep = new DocGiaRepository();
               dgRep.ThemDocGia(docGiaDTO);
           }
           catch (System.Exception)
           {

           }
       }

       public static int  LayMaDocGiaMax()
       {
           int maTheDG = 0;
           try
           {
               DocGiaRepository dgRep = new DocGiaRepository();
               maTheDG = dgRep.LayMaDocGiaMax();
           }
           catch (System.Exception)
           {
           }
           return maTheDG;
       }

       public static string PhatSinhMaTheDocGia(string maTheDG)
       {
           DocGiaRepository dgRep = new DocGiaRepository();
           maTheDG = dgRep.PhatSinhMaTheDocGia(maTheDG);
           return maTheDG;
       }

       public static DocGiaDTO LayThongTinDocGia(int maDocGia)
       {
           DocGiaDTO docGiaDTO = new DocGiaDTO();
           try
           {
               DocGiaRepository dgRep = new DocGiaRepository();
               docGiaDTO = dgRep.LayThongTinDocGia(maDocGia);
           }
           catch (System.Exception)
           {

           }
           return docGiaDTO;
       }

       public static void CapNhatDocGia(DocGiaDTO docGiaDTO)
       {
           try
           {
               DocGiaRepository dgRep = new DocGiaRepository();
               dgRep.CapNhatDocGia(docGiaDTO);

           }
           catch (System.Exception)
           {

           }
       }

       public static void XoaDocGia(int maTheDocGia, DocGiaDTO docGiaDTO)
       {
           try
           {
               DocGiaRepository dgRep = new DocGiaRepository();
               dgRep.XoaDocGia(maTheDocGia, docGiaDTO);
           }
           catch (System.Exception)
           { 

           }
       }

       public static DataTable TraCuuDocGia(string hoTen, int maLoaiDocGia)
       {
           DocGiaRepository docGiaRep = new DocGiaRepository();
           return docGiaRep.TraCuuDocGia(hoTen, maLoaiDocGia);
       }

       //Thong ke doc gia no tien phat
       public static DataTable ThongKeDocGiaNoTienPhat()
       {
           DocGiaRepository docGiaRep = new DocGiaRepository();
           return docGiaRep.ThongKeDocGiaNoTienPhat();
       }
    }
}
